#!/bin/sh

# https://www.rabbitmq.com/clustering-ssl.html
ERL_SSL_PATH="$(erl -eval 'io:format("~p", [code:lib_dir(ssl, ebin)]),halt().' -noshell)"

sslErlArgs="-pa $ERL_SSL_PATH 
    -proto_dist inet_tls
    -ssl_dist_opt server_certfile /certs/combined.pem
    -ssl_dist_opt server_secure_renegotiate true client_secure_renegotiate true"

SERVER_ADDITIONAL_ERL_ARGS="$sslErlArgs"
CTL_ERL_ARGS="$sslErlArgs"
if [ -n "$ERLANG_COOKIE" ]; then
	SERVER_ADDITIONAL_ERL_ARGS="$SERVER_ADDITIONAL_ERL_ARGS -setcookie $ERLANG_COOKIE"
	CTL_ERL_ARGS="$CTL_ERL_ARGS -setcookie $ERLANG_COOKIE"
fi
